package com.wzdigit.wms.wms.filter.wrapper;
/*
 * @Author:yangwenbiao
 * @Date 2020/7/13 9:14 AM
 * @version 1.0
 */

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

//@Component
public class ParamHttpServletRequestWrapper extends HttpServletRequestWrapper {
    public ParamHttpServletRequestWrapper(HttpServletRequest request) {
        super(request);
    }


    /**
     * 将空字符串设置成null
     *
     * @param name
     * @return
     */
    @Override
    public String[] getParameterValues(String name) {
        String[] parameterValues = super.getParameterValues(name);

        if (null != parameterValues && parameterValues[0].equals("")) {
            parameterValues[0] = null;
        }
        return parameterValues;
    }
}
